package com.kiln.juxingqs.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView
import client.global.commlib.base.BaseLoadmoreAdapter
import client.global.commlib.base.BindingViewHoder
import com.kiln.juxingqs.R
import com.kiln.juxingqs.api.bean.ZrOrder
import com.kiln.juxingqs.databinding.ItemZrSpecialDetailBinding

class ZrSpecialDetailAdapter : BaseLoadmoreAdapter<ZrOrder.Order> {

//    val isShowing = MutableLiveData<Boolean>(false)
//    val operation = MutableLiveData<String>()

    constructor(context: Context) : super(context) {
    }

    override fun createVh(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return BindingViewHoder(
            DataBindingUtil.inflate(
                layoutInflater,
                R.layout.item_zr_special_detail,
                parent,
                false
            )
        )
    }

    override fun bindVh(holder: RecyclerView.ViewHolder, position: Int) {
        val bindingViewHolder = holder as BindingViewHoder<ViewDataBinding>
        val binding = bindingViewHolder.binding as ItemZrSpecialDetailBinding
        binding.apply {
            isShowing = false//不显示操作按钮
        }

        val bean = getItem(position)
        binding.bean = bean
        binding.event = this

        val time = bean.create_time.substring(5, bean.create_time.length - 3)
        val expire_time = bean.expire_time.substring(5, bean.expire_time.length - 3)
        binding.time = time
        binding.expireTime= expire_time

    }


}
